package com.xwj.coupon.user.service.handler.excel.amount;

import com.xwj.coupon.user.common.enums.DiscountTypeEnum;
import com.xwj.coupon.user.repository.mysql.entity.CouponTemplateDO;

/**
 * @Author: XuWenjie
 * @Date: 2025-08-21
 * @Description: FixedComputeAmountHandler
 */
public class FixedComputeAmountHandler extends ComputeAmountHandler{
    @Override
    public boolean check(CouponTemplateDO couponTemplate, Long amount) {
        return couponTemplate.getType().equals(DiscountTypeEnum.FIXED_DISCOUNT.getType());
    }

    @Override
    public Long compute(CouponTemplateDO couponTemplate, Long amount) {
        return amount - couponTemplate.getPromotionValue();
    }
}
